<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>
			5*:实现时间的显示功能，
			要求能显示星期几，年月日，小时分钟秒,并能随着时间的变化而变化。。。</title>
		<script>
			setInterval(function(){
			showtime();	
			},1000);
			function showtime() {
				var t = new Date();
				var year = t.getFullYear();
				var month = t.getMonth() + 1;
				var day = t.getDate();
				var weekday = t.getDay();
				var hour = t.getHours();
				var minute = t.getMinutes();
				var second = t.getSeconds();
				var week=["日","一","二","三","四","五","六"]
				weekday="星期"+week[weekday];
				var a =year+"年 "+month+"月 "+day+"日 "+weekday+"  "+hour+":"+minute+":"+second;
				document.getElementById("datetime").innerHTML=a;
			}
			
			
		</script>
	</head>
	<body>
		<p id="datetime"></p>
	</body>
</html>
